﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kiel.Pdf
{
	/// <summary>
	/// Represents a Dictionary Object.
	/// </summary>
	class PdfDictionary : Dictionary<PdfName, IPdfObject>, IPdfObject
	{
		public IPdfObject this[string name]
		{
			get { return this[PdfName.Create(name)]; }
			set { this[PdfName.Create(name)] = value; }
		}

		public bool ContainsKey(string name)
		{
			return this.ContainsKey(PdfName.Create(name));
		}

		public override string ToString()
		{
			StringBuilder text = new StringBuilder();
			text.Append("<<");
			foreach (var item in this)
			{
				text.AppendFormat("{0} {1}", item.Key.ToString(), item.Value.ToString());
				text.AppendLine();
			}
			text.Append(">>");
			return text.ToString();
		}
	}
}
